/**
 * 
 */
package com.android.demolayoutpages;

import com.android.demolayoutpages.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

/**
 * @author INVEERA
 *
 */
public class ImageAdapter extends BaseAdapter {
	Integer pics[] = { R.drawable.img_thumb1, R.drawable.img_thumb2, R.drawable.img_thumb3, R.drawable.img_thumb4,
			R.drawable.img_thumb5 };

	private Context ctx;
	

	public ImageAdapter(Context c) {
		ctx = c; 
	}

	@Override
	public int getCount() {

		return pics.length;
	}

	@Override
	public Object getItem(int arg0) {

		return arg0;
	}

	@Override
	public long getItemId(int arg0) {

		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {

		ImageView iView = new ImageView(ctx);
		iView.setImageResource(pics[arg0]);
		iView.setScaleType(ImageView.ScaleType.FIT_XY);
		iView.setLayoutParams(new Gallery.LayoutParams(200/3, android.widget.LinearLayout.LayoutParams.FILL_PARENT));
		return iView;
	}
	

}
